home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 5 / chrpro3.zip / MCONSTAT.CMD < prev    next >
OS/2 REXX Batch file  |  1991-01-21  |  7KB  |  268 lines

  1. * Program MCONSTAT - Prints a one-period contributions report (indiv statement)
  2. Select secondary
  3. USE CDIRFILE index CDIRFILE
  4. Store curdates to curdatex
  5. GOTO 10
  6. Store !($(spact,26,1)) to offsform
  7. SKIP
  8. Store !($(spact,21,1)) to offpledg
  9. Store '0' to N
  10. If OFFNOTE
  11.   GOTO 27
  12.   Store 'x' to offnote9
  13.   Do while # < 47
  14.     Store $(spact,2,39) to OFFNOTE9
  15.     SKIP
  16.       Store OFFNOTE9+$(spact,2,39) to OFFNOTE&N
  17.     Store str(val(N)+1,1) to N
  18.     SKIP
  19.   enddo
  20.   If N='*'
  21.     Store '9' to N
  22.   endif
  23.   Do while OFFNOTE&N = ;
  24. '                                                                             '
  25.     Store str(val(N)-1,1) to N
  26.   enddo
  27. endif
  28. Store str(val(N)+1,1) to NN
  29. Select primary
  30. Store '-' to NMFL
  31. Select secondary
  32. Store d+':MEMBERS' to MFILE
  33. Store d+':OFFERNDX.NDX' to NFILE
  34. If .not. file(MFILE)
  35.  ? 'MEMBERS.DBF file not present on the data disk. It must be copied over'
  36.  Accept 'from the MPROFILE program system/disk. Press <RETURN>' to XX
  37.  USE CDIRFILE index CDIRFILE
  38.  Select primary
  39.  RETURN
  40. endif
  41. If .not. file(NFILE)
  42.   ? 'Offering index file OFFERNDX, now being created against MEMBERS file.'
  43.   Use &MFILE
  44.   Set talk on
  45.   Index on offeringen to &NFILE
  46.   Set talk off
  47. endif
  48. USE &MFILE index &NFILE
  49. ? 'This routine prints a report. Ready the printer.'
  50. Accept 'Print statements for all members? ' to XX
  51. If !(XX) = 'Y'
  52.   Store offermax to maxrec
  53.   Accept 'Enter starting envelope number, or press <retn> for beginning ' to XX
  54.   If !(XX)=' '
  55.     Store 1 to recnum
  56.     Find 1
  57.     If #=0
  58.       Store 2 to recnum
  59.       Find 2
  60.       If #=0
  61.         Store 3 to recnum
  62.         Find 3
  63.         If #=0
  64.  Accept 'No envelope number less than 3 in MEMBERS file. Press <retn> '  to XX
  65.  RETURN
  66.         endif
  67.       endif
  68.     endif
  69.   else
  70.     Store val(XX) to recnum
  71.   endif
  72. else
  73.   Accept 'Enter a single envelope number needing a statement ' to XX
  74.   IF !(XX)='Q'
  75.     Use
  76.     Select primary
  77.     RETURN
  78.   ENDIF
  79.   IF !(XX)=' '
  80.     STORE 1 TO RECNUM
  81.   ELSE
  82.     Store val(XX) to recnum
  83.   ENDIF
  84.   Store recnum+1 to maxrec
  85. endif
  86. Store str(recnum,4) to rec
  87. Release XX,continu,valid2,osel,mfile,nfile,validd1,level1,goodhdr
  88. Release pageprnt,offermax,prnt,msel,nmonth
  89. Select primary
  90. GOTO &rec
  91. STORE 0 TO NONM
  92. Set format to print
  93. Do while RECNUM<MAXREC .and. .not. EOF
  94.   Select secondary
  95.   Find &rec
  96.   If (last:name)='          ' .or. #=0
  97.     If val(OCATEG&OT)<>0
  98.       ? 'No name for envelope number',rec
  99.       Store NONM+1 to NONM
  100.       If NONM > 50
  101.         Set format to screen
  102. ? 'Too many envelope numbers without corresponding names in MEMBERS file:',NMFL
  103.         Accept 'Press <retn> to terminate ' to PRNT
  104.         RETURN
  105.       else
  106.         Store trim(NMFL)+str(recnum,4)+'-' to NMFL
  107.       endif
  108.       Store 1 to PRNT
  109.     endif
  110.   else
  111.     Store trim(first:name) to tfname
  112.     Store trim(last:name) to namet
  113.     Store address to addresst
  114.     Store trim(city:state)+'  '+trim(zip) to cityst
  115.     * If husband and wife, print both their names, husband first
  116.     SKIP
  117.     If offeringen=recnum
  118.       If $(familycode,8,1)='2'
  119.         Store tfname+' and '+trim(first:name) to tfname
  120.       else
  121.         Store trim(first:name)+' and '+tfname to tfname
  122.       endif
  123.     else
  124.       SKIP -1
  125.     endif
  126.     Store tfname+' '+namet to namet
  127.     Select primary
  128. *  Print one Contribution Statement
  129. Store '0' to N
  130. Do while N<>OT
  131.   STORE STR(VAL(N)+1,1) TO N
  132.   Store 0.00 to GIVING
  133.   Store 1 to wknum
  134.   Do while WKNUM < WKNUMMAX
  135.     Store $(OCATEG&N,WKNUM*8+2,8) to GIVING1
  136.     Store &GIVING1 + GIVING TO GIVING
  137.     Store wknum+1 to WKNUM
  138.   enddo
  139.   Store GIVING to OCATEGT&N
  140.   Store $(OCATEG&N,1,9) to GIVING1
  141.   Store &GIVING1+GIVING to OCATEGY&N
  142. enddo
  143. Release GIVING,GIVING1
  144. Set format to print
  145. If offsform<>'Y'
  146.   @ 2,25 say CHNAME
  147.   @ 6,20 say ' C O N T R I B U T I O N   R E C O R D'
  148. endif
  149.   @ 12,12 SAY NAMET
  150.   @ 12,50 SAY curdate
  151.   @ 13,12 SAY ADDRESST
  152.   @ 14,12 SAY CITYST
  153. IF OFFSFORM<>'Y'
  154.   @ 14,50 SAY 'ENVELOPE'
  155. ENDIF
  156. @ 14,60 SAY STR(OFFERINGEN,4)
  157. @ 22,25 SAY 'Report of Contributions through '+CMONTHCO
  158. Store '0' to N
  159. Store 20 to CN
  160. If offsform<>'Y'
  161.   @ 26,16 say HDR3
  162. endif
  163. Store 28 to LN
  164. Store 10 to WKNO
  165. Store 1 to week
  166. STORE 1 to wknum
  167. Do while wknum < wknummax
  168.   @ LN,12 say $(curdatex,week,5)
  169.   Store '0' to N
  170.   Store 21 to CN
  171.   Do while N<>OT
  172.     Store str(val(N)+1,1) to N
  173.     Store $(OCATEG&N,WKNO,8) to resp
  174.     If resp<>'        '
  175.       @ LN,CN say '$'+resp
  176.     endif
  177.     If CSA<>' '.and. N='4'
  178.       @ LN,67 say $(SPACCOUNTS,wknum+1,1)
  179.     endif
  180.     Store CN+12 to CN
  181.   enddo
  182.   Store LN+1 to LN
  183.   Store WKNO+8 to WKNO
  184.   Store wknum+1 to wknum
  185.   Store week+6 to week
  186. enddo
  187. Store LN+2 to LN
  188. If OFFSFORM<>'Y'
  189.   @ LN,0 say 'Totals for '+cmonthco
  190. endif
  191. Store 20 to CN
  192. Store '0' to N
  193. Do while N<>OT
  194.   Store str(val(N)+1,1) to N
  195.   Store str(ocategt&N,9,2) to XX
  196.   @ LN,CN say '$'+XX
  197.   Store CN+12 to CN
  198. enddo
  199. Store LN+1 to LN
  200. Store 20 to CN
  201. If OFFSFORM<>'Y'
  202.   @ LN,0 say 'YEAR-TO-DATE'
  203. endif
  204. Store '0' to N
  205. Do while N<>OT
  206.   Store str(val(N)+1,1) to N
  207.   Store str(OCATEGY&N,9,2) to XX
  208.   @ LN,CN say '$'+XX
  209.   Store CN+12 to CN
  210. enddo
  211. If offpledg='Y'
  212.   Store LN+2 to LN
  213.   @ LN,30 say 'Pledged for the year:  $'+pledged
  214. endif
  215. Store LN+2 to LN
  216. Store LN+12 to CN
  217. Store '0' to N
  218. Do while N<>NN
  219.     @ LN,1 say OFFNOTE&N
  220.     Store LN+1 to LN
  221.     Store str(val(N)+1,1) to N
  222. enddo
  223. endif
  224. EJECT
  225. * End of one statement
  226.   Store recnum+1 to recnum
  227.   Store str(recnum,4) to rec
  228.   Select primary
  229.   SKIP
  230. enddo
  231. If recnum<maxrec
  232.   ? 'CONTRIB file has less than the user-defined maximum envelope number.'
  233.   ? 'Statement printing is terminated.'
  234. endif
  235. Set format to screen
  236. If NONM>0
  237.   ERASE
  238.   @ 2,2 say 'THE FOLLOWING ENVELOPE NUMBERS HAVE NO NAMES IN THE'
  239.   @ 3,2 SAY "MEMBERS FILE. NO STATEMENTS WERE PRINTED FOR THEM:"
  240.   ? ' '
  241.   ? NMFL
  242. ENDIF
  243. ?
  244. If OFFNOTE
  245.   Release OFFNOTE0,OFFNOTE1,OFFNOTE2,OFFNOTE3,OFFNOTE4,OFFNOTE5,OFFNOTE6,;
  246.           OFFNOTE7,OFFNOTE8,OFFNOTE9
  247. endif
  248. ACCEPT 'End of Contributions Statements. Press <retn> to exit.' to XX
  249. RETURN
  250.  
  251. 
  252. Store 10 to WKNO
  253. Store 1 to week
  254. STORE 1 to wknum
  255. Do while wknum < wknummax
  256.   @ LN,12 say $(curdatex,week,5)
  257.   Store '0' to N
  258.   Store 21 to CN
  259.   Do while N<>OT
  260.     Store str(val(N)+1,1) to N
  261.     Store $(OCATEG&N,WKNO,8) to resp
  262.     If resp<>'        '
  263.       @ LN,CN say '$'+resp
  264.     endif
  265.     If CSA<>' '.and.N=4
  266.       @ LN,67 say $(SPACCOUNT,wknum+1,1)
  267.     endif
  268.